<?php
namespace API\Controller;
use Think\Controller;
header("Content-Type: text/json; charset=utf-8");
Vendor('hdphp.autoload');
Vendor('hdphp\houdunwang\crypt.Crypt');
/**
* hdphp加密内核
*/
class PublicController extends Controller
{
	   /**
	    * 加密方法
	    * @param [type] $EncryptData [description]
	    */
		public function HdEncrypt($EncryptData){
		$Hd =  \houdunwang\crypt\Crypt::encrypt($EncryptData);
	    return $Hd;
	}
	/**
	 * 正则替换，ASCII码转中文
	 * @param  [type] $str [description]
	 * @return [type]      [description]
	 */
	    public	function yuejian($str){
         echo preg_replace_callback('/\\\\u([0-9a-f]{4})/i', create_function('$matches', 'return iconv("UCS-2BE","UTF-8",pack("H*", $matches[1]));'), json_encode($str));
    exit;
    }
  public function  codedate($code,$msg){
     $sentdata = array('code'=>$code,'msg'=>$msg);
     echo json_encode($sentdata);
     exit;
  }
	
}